package cm.project;

import java.io.*;
import java.util.ArrayList;
import java.util.List;

public class Test6 {
    public static void main(String[] args) throws IOException {
        List<Student>list=new ArrayList<>();
        list.add(new Student("迪丽热巴","女",18,99.0));
        list.add(new Student("古力娜扎","女",19,98.0));
        list.add(new Student("周杰伦","男",20,88.0));
        list.add(new Student("蔡徐坤","男",19,78.0));
        for (Student student : list) {
            BufferedWriter bw=new BufferedWriter(new FileWriter("Task2.txt",true));
            bw.write(student.toString());
            bw.write("\r\n");
            bw.close();
        }


    }
}
